package acm.pta2;

import java.util.Scanner;

public class T3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int AN=A;
        int B = scanner.nextInt();
        int BN=B;
        int N = scanner.nextInt();
        for (int i = 0; i < N; i++) {
            int a1 = scanner.nextInt();
            int a2 = scanner.nextInt();
            int b1 = scanner.nextInt();
            int b2 = scanner.nextInt();
            if (a1 + b1 == a2 && a1 + b1 != b2) {
                A--;
            } else if (a1 + b1 != a2 && a1 + b1 == b2) {
                B--;
            }
            if (A < 0) {
                System.out.println("链表去重");
                System.out.println(BN-B);
                break;
            } else if (B < 0) {
                System.out.println("C");
                System.out.println(AN-A);
                break;
            }
        }
    }
}
